# -*- coding: utf-8 -*-

import jsonpath

dic = {
    "resultCode": "1",
    "resultMsg": "success",
    "reqId": "52f9f3e1-1d76-47b4-b2ae-226633b61476",
    "systemTime": "1681991278593",
    "videoInfo": {
        "playSta": "1",
        "video_image": "https://image.pearvideo.com/cont/20170714/cont-1110173-10436784.png",
        "srcUrl": "https://www.baidu.com",
        "videos": {
            "hdUrl": "",
            "hdflvUrl": "",
            "sdUrl": "",
            "sdflvUrl": "",
            "srcUrl": "https://video.pearvideo.com/mp4/short/20170714/1681991278593-10632788-hd.mp4"
        }
    }
}

# 不需要考虑节点位置，直接取对应的key(默认取出所有的值)
print(jsonpath.jsonpath(dic, '$..srcUrl'))
# 返回的是list数据
# print(jsonpath.jsonpath(dic, '$..video_image'))
#
# # . :匹配下一级元素
# print(jsonpath.jsonpath(dic,'$..videos.srcUrl'))
# print(jsonpath.jsonpath(dic,'$..videoInfo.srcUrl'))